package com.lg.erp.controller.chenjunhui;


import com.lg.erp.entity.JsonResult;
import com.lg.erp.entity.chenjunhui.TProductionLine;
import com.lg.erp.entity.jml.TPost;
import com.lg.erp.service.chenjunhui.ITProductionLineService;
import com.lg.erp.service.jml.ITPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Calendar;
import java.util.List;
import java.util.UUID;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lg
 * @since 2021-04-20
 */
@RestController
public class TProductionLineController {
    @Autowired
    private ITProductionLineService itProductionLineService;

    /**
     * 查询所有
     * @return
     */
    @GetMapping("/allProductionLine")
    public JsonResult selectAll(){
        List<TProductionLine> tProductionLines = itProductionLineService.list();
        return new JsonResult(1,"ok",tProductionLines);
    }


    /**
     * 添加
     * @param tProductionLine
     * @return
     */
    @PostMapping("/allProductionLine")
    public JsonResult addAll(@RequestBody TProductionLine tProductionLine){
        itProductionLineService.addTProductionLine(tProductionLine);
        return new JsonResult(1,"ok",null);
    }

    /**
     * 修改
     * @param tProductionLine
     * @return
     */
    @PutMapping("/allProductionLine")
    public JsonResult updateAll(@RequestBody TProductionLine tProductionLine){
        itProductionLineService.updateById(tProductionLine);
        return new JsonResult(1,"ok",null);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @ResponseBody
    @DeleteMapping("/allProductionLine/{id}")
    public JsonResult deleteAll(@PathVariable String id){
        System.out.println(id);
        itProductionLineService.deleteTProductionLine(id);
        return new JsonResult(1,"ok",null);
    }

}
